# -*- coding: utf8 -*-
import string
from kivy import Logger
from kivy.properties import ObjectProperty

from kivy.uix.accordion import Accordion, AccordionItem


class EasyLangLearnAccordion(Accordion):
    pass


class EasyLangLearnAccordionItem(AccordionItem):
    log_data = ObjectProperty()

    def __init__(self, classification_id, title, logs):
        super(EasyLangLearnAccordionItem, self).__init__(title=title)

        self.classification_id = classification_id

        log_info = []

        Logger.info(str(logs))

        for log in logs:
            log_info.append("[b]%s:[/b] %s (%d думи, %.2f%% успех)" % (
                log['EXAM_DATE'][:10], log['EXAM_INFO'], log['WORDS_COUNT'], log['EXAM_PERCENT']))
        self.log_data.text = string.join(log_info, "\n")


